<?php 

class AdminNewsPresenter extends AdminPresenter{
	
	private $model;
	/**
	 * Start lifecycle presenter
	 *
	 * @return void
	 */
	protected function startup(){
		parent::startup();
		
		$this->model = NewsModel::getInstance();
	}

	/**
	 * Settings for all render
	 *
	 * @return void
	 */
	protected function beforeRender(){

	}

	/**
	 * Render default action
	 *
	 * @return void
	 */
	public function renderDefault($id){
		
		$this->template->title = "Přehled novinek";
		$this->template->id = $id;
	}
	
	public function actionAddNews($id){

		$this->template->title = "Přidat Novinku";
		$this->template->form = $this->getComponent('addNews');

	}
	
	public function createComponentAddNews($id){
		
		$form = new AppForm();
		
		$form->addTextArea("content","Obsah:")->setDefaultValue($info[0]["content"]);
		$form["content"]->getControlPrototype()->class = "editor";
		
		$form->addHidden("id_menu")->setDefaultValue($ident);
		
		$form->addSubmit('confirm', 'Uložit')->getControlPrototype()->class('submit');
		$form->onSubmit[] = array($this, 'PageSubmitted');
		
		return $form;
	}
}

?>